/*
 * @Description: 渠道管理
 * @Author: 颜博骏 bojun@ssc-hn.com
 * @Date: 2024-04-12
 * @LastEditors: 颜博骏 bojun@ssc-hn.com
 * @LastEditTime: 2024-06-21
 */
import request from '/@/api/request'

/**
 * 渠道列表分页
 */
export const requestGetChannelList = (data: GetChannelListTypes.IRequest) => {
  return request.post<IPaginationResponse<GetChannelListTypes.IResponse[]>>('/business/tracecode/channel/list/V1', data)
}

/**
 * 下级渠道列表查询
 */
export const requestGetSubChannelList = (data: GetChannelSublistTypes.IRequest) => {
  return request.get<IPaginationResponse<GetChannelSublistTypes.IResponse[]>>('/business/tracecode/channel/querySubChannel/V1', data)
}

/**
 * 一级渠道新增
 */
export const requestAddChannel = (data: AddChannelTypes.IRequest) => {
  return request.post<IBaseResponse<AddChannelTypes.IResponse>>('/business/tracecode/channel/oneLevelAdd/V1', data)
}

/**
 * 批量删除
 */
export const requestBatchDelete = (data: BatchDeleteTypes.IRequest) => {
  return request.post<IBaseResponse<BatchDeleteTypes.IResponse>>('/business/tracecode/channel/batchDelete/V1', data)
}

/**
 * 下级渠道新增
 */
export const requestAddSubChannel = (data: AddSubChannelTypes.IRequest) => {
  return request.post<IBaseResponse<AddSubChannelTypes.IResponse>>('/business/tracecode/channel/lowerLevelAdd/V1', data)
}

/**编辑渠道 */
export const requestEditChannel = (data: EditChannelTypes.IRequest) => {
  return request.post<IBaseResponse<EditChannelTypes.IResponse>>('/business/tracecode/channel/update/V1', data)
}

/**编辑渠道时回显的信息 */
export const requestGetEditInfo = (data: EditInfoTypes.IRequest) => {
  return request.get<IBaseResponse<EditInfoTypes.IResponse>>('/business/tracecode/channel/getById/V1', data)
}

/**渠道删除 */
export const requestDeleteChannel = (data: DeleteChannelTypes.IRequest) => {
  return request.get<IBaseResponse<DeleteChannelTypes.IResponse>>('/business/tracecode/channel/delete/V1', data)
}

/** 获取一级渠道 */
export const requestFirstChannel = (data: FirstChannelTypes.IRequest) => {
  return request.post<IPaginationResponse<FirstChannelTypes.IResponse[]>>('/business/tracecode/channel/channelList/V1', data)
}

/** 获取下级渠道 */
export const requestSubChannel = (data: SubChannelTypes.IRequest) => {
  return request.get<IPaginationResponse<SubChannelTypes.IResponse[]>>('/business/tracecode/channel/querySubChannel/V1', data)
}

/** 查看码（分页） */
export const requestCheckCodeList = (data: CheckCodesTypes.IRequest) => {
  return request.post<IPaginationResponse<CheckCodesTypes.IResponse[]>>('/business/tracecode/channel/checkCodes/V1', data)
}
/** 分配码查询 */
export const requestDistributionSearch = (data: DistributionCodeTypes.IRequest) => {
  return request.post<IBaseResponse<DistributionCodeTypes.IResponse>>('/business/tracecode/channel/distributionCheck/V1', data)
}

/** 分配码确认 */
export const requestDistributionConfirm = (data) => {
  return request.post('/business/tracecode/channel/distribution/V1', data)
}

/** 校验当前登录人是否属于一级渠道 */
export const requestCheckOneLevel = (data: CheckOneLevelTypes.IRequest) => {
  return request.get<IBaseResponse<CheckOneLevelTypes.IResponse>>('/business/tracecode/channel/checkOneLevel/V1', data)
}
